# lowest priced itinerary with a stopover at city c of at least k hours

# must have an incoming edge at forced via point; the outgoing edge is
# taken care of by the flow conservation constraints

subject to c_forced_stopover {forced_via_point in p_forced_via_point} :
sum {(i,forced_via_point,k,l) in ARCS} itinerary[i,forced_via_point,k,l] = 1;

# enforce forced via-point minimum layover requirement
# for a forced stop, the layover has to be between p_forced_via_point_min_layover
# and (p_forced_via_point_min_layover + max_allowed_layover)

subject to c_forced_stopover_duration_lb {forced_via_point in p_forced_via_point}:
sum {(forced_via_point,j,k,l) in ARCS} itinerary[forced_via_point,j,k,l]*(24*(l-1) + floor(depart_tm[k]/100) + (depart_tm[k] mod 100)/60)
- sum {(o,forced_via_point,m,n) in ARCS} itinerary[o,forced_via_point,m,n]*(24*(n+arrive_day[m]-1) + floor(arrive_tm[m]/100) + (arrive_tm[m] mod 100)/60)
>= p_forced_via_point_min_layover;


subject to c_forced_stopover_duration_ub {forced_via_point in p_forced_via_point}:
sum {(forced_via_point,j,k,l) in ARCS} itinerary[forced_via_point,j,k,l]*(24*(l-1) + floor(depart_tm[k]/100) + (depart_tm[k] mod 100)/60)
- sum {(o,forced_via_point,m,n) in ARCS} itinerary[o,forced_via_point,m,n]*(24*(n+arrive_day[m]-1) + floor(arrive_tm[m]/100) + (arrive_tm[m] mod 100)/60)
<= (p_forced_via_point_min_layover + max_allowed_layover);
